package com.example.spareparts.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import com.example.spareparts.entity.SpareCategory;
import com.example.spareparts.repository.SpareCategoryRepository;

@Service
public class SpareCategoryService {
    @Autowired
    private SpareCategoryRepository spareCategoryRepository;
    public List<SpareCategory> findAllSpareCategory(){
        return spareCategoryRepository.findAllSpareCategory();
    }

    public void insertSpareCategory(SpareCategory spareCategory){
        spareCategoryRepository.insertSpareCategory(spareCategory);
    }

    public void updateSpareCategory(SpareCategory spareCategory){
        spareCategoryRepository.updateSpareCategory(spareCategory);
    }

    public void deleteSpareCategory(Long categoryid){
        spareCategoryRepository.deleteSpareCategory(categoryid);
    }
    public SpareCategory findSpareCategoryById(Long categoryid){
        return spareCategoryRepository.findSpareCategoryById(categoryid);
    }
    public List<SpareCategory> findSpareCategoryBySparePartId(Long sparepartid){
        return spareCategoryRepository.findSpareCategoryBySparePartId(sparepartid);
    }


}
